export default {
    data: {
        title: 'World',
        text: "",
        username: "",
        password: "",
        visibility: true,
        focusId: 0,
    },

    keyClicked (clicked) {
        this.text = clicked.detail.text;
        if(this.focusId == 1) {
            this.username += clicked.detail.text;
        } else if(this.focusId == 2) {
            this.password += clicked.detail.text;
        }

    },

    clearClicked (clicked) {
        if(this.focusId == 1) {
            this.username = "";
        } else if(this.focusId == 2) {
            this.password = "";
        }
    },


    clearUsernameClicked (clicked) {
        this.username = "";
    },

    clearPasswordClicked (clicked) {
        this.password = "";
    },

    keybackClicked (clicked) {
        if(this.focusId == 1) {
            this.username = this.username.slice(0, -1);
        } else if(this.focusId == 2) {
            this.password = this.password.slice(0, -1);
        }



    },
    hideBoard (clicked) {
        this.visibility = clicked.detail.visibility;
    },

    onFocusName: function () {
//        console.log("onFocusName.");
        this.focusId = 1;
        this.text = this.username;

        if(this.visibility == false) {
            this.visibility = true;
        }
    },

    onFocusPassword: function () {
//        console.log("onFocusPassword.");
        this.focusId = 2;
        this.text = this.password;

        if(this.visibility == false) {
            this.visibility = true;
        }
    },
}
